<?php
require_once(ADDON_PATH.'IcWaterGoods'.'/Common/Function.php');
 $config = array(
	/*信息分类*/
	'info_type' => array(
		0=>'求购信息',
		1=>'货品信息'
	),
	/*商家认证*/
	'authentication_status' => array(
		0=>'删除',
		1=>'待审核',
		2=>'已通过'
	),
);
return array(
	'name' => '水产圈',
	'bzname' => 'IcWaterGoods',
	'desc' => '水产圈插件',
	'version' => '1.0',
	'author' => '16，陈浩南',
    'logo' => 'logo.png',
    'install_sql' => 'install.sql',
	'config' => array(
		'respond_rule' => 0,
		'setting' => 1,
		'entry' => 1,
		'entry_list' => array(
            'index' => '主页'
        ),
		'menu' => 1,
		'menu_list' => array(
            'lists/model/ren_lists' => '认证列表',
            'lists/model/types_lists' => '信息分类列表',
            'lists/model/good_lists' => '信息列表',
            'lists/model/usertype_lists' => '用户权限列表',
            // 'custMessages' => '自定义信息管理'
        ),
		'setting_list' => array(
            'index_title' => array(
                'title' => '首页分享标题',
                'type' => 'text',
            ),
            'index_imgs' => array(
                'title' => '首页分享图片',
                'type' => 'image',
            ),
            'index_desc' => array(
                'title' => '首页分享描述',
                'type' => 'text',
            ),
           
            'is_guan' => array(
                'title' => '是否需要关注',
                'type' => 'radio',
                'format' => 'enum',
                'extra' => array(
                    'options' => array(
                        1 => '是',
                        0 => '否',
                    )
                )
            ),
            'need_auth' => array(
                'title' => '是否认证才能发布',
                'type' => 'radio',
                'format' => 'enum',
                'extra' => array(
                    'options' => array(
                        1 => '是',
                        0 => '否',
                    )
                )
            ),
            'guan_imgs' => array(
                'title' => '公众号二维码',
                'type' => 'image',
            ),
            'max_fabu' => array(
                'title' => '每天发布最大次数',
                'type' => 'text',
                'tip' => '不填则表示不限制'
            ),
         ),
	),
	'model'=>array(
		'ren_lists'=>array(
			'name'=>'ic_authentication',
			'meta_title'=>'认证列表',
   			'btn'=>array(
   				// array('title'=>'一键更新','url'=>create_addon_url('updateFans'),'class'=>'btn btn-info')
   			),
			'lists'=>array(
				array('name' => 'id','title' => '主键', 'format' => 'hidden' ),
                array('name' => 'shop_name','title' => '商家名', 'format' => 'text' ), 
                array('name' => 'mobile','title' => '电话号码', 'format' => 'text' ), 
                array('name' => 'img1','title' => '图片1', 'format' => 'image' , 'extra'=>array('attr'=>"width=\"300\" height=\"300\"")), 
                array('name' => 'img2','title' => '图片2', 'format' => 'image' ,'extra'=>array('attr'=>"width=\"300\" height=\"300\"")), 
                array('name' => 'status',
                	'title' => '状态', 
                	'format' => 'enum',
                	'extra' => array(
                        'options' => $config['authentication_status'],
                    )
                ),  
                array(	
                	'name' => 'id',
                	'title' => '操作', 
                	'format' => 'custom' ,
                	'extra'=>array(
                		'options'=>array(
                			'shen'=>array('title' => '审核','url'=>web_urls('setStatus',array('id'=>'{id}')),'class'=>'btn btn-primary btn-sm icon-edit'),
                			'del'=>array('title' => '删除','url'=>web_urls('delete',array('id'=>'{id}','db'=>'ic_authentication')),'class'=>'btn btn-success btn-sm icon-delete'),
                		),
                	),
            	),   
            ),          
			'list_map'=>array('mpid'=>get_mpid(),'status'=>array('neq',0)),
			'list_order'=>array('id DESC'),
		),	
		'types_lists'=>array(
			'name'=>'ic_goods_types',
			'meta_title'=>'信息分类列表',
   			'btn'=>array(
   				array('title'=>'添加分类','url'=>web_urls('add',array('model'=>'types_oper')),'class'=>'btn btn-info')
   			),
			'lists'=>array(
					array('name' => 'id','title' => '主键', 'format' => 'hidden' ),
	                array('name' => 'type_name','title' => '分类名', 'format' => 'text' ), 
	                array(
	                    'name' => 'create_time',
	                    'title' => '发布时间',
	                    'format' => 'function',
	                    'extra' => array(
	                        'function_name' => 'date',
	                        'params' => 'm-d H:i,###'
	                    )
                	),
	                array(
	                	'name' => 'id',
	                	'title' => '操作', 
	                	'format' => 'custom' ,
	                	'extra'=>array(
	                		'options'=>array(
	                			'edit'=>array('title' => '编辑','url'=>web_urls('edit',array('id'=>'{id}','model'=>'types_oper')),'class'=>'btn btn-success btn-sm icon-edit'),
	                			'del'=>array('title' => '删除','url'=>web_urls('types_delete',array('id'=>'{id}','db'=>'ic_goods_types')),'class'=>'btn btn-success btn-sm icon-delete'),
	                			'childTypes'=>array('title' => '子分类','url'=>create_addon_url('lists',array('pid'=>'{id}','model'=>'type_lists')),'class'=>'btn btn-success btn-sm icon-edit'),
	                		),
	                ),
	            ),   
            ),          
			'list_map'=>array('mpid'=>get_mpid(),'status'=>array('neq',0),'pid'=>0),
			'list_order'=>array('id DESC'),
		),	
		'type_lists'=>array(
			'name'=>'ic_goods_types',
			'meta_title'=>'信息分类列表',
			'btn'=>array(
					array('title'=>'添加分类','url'=>web_urls('add',array('model'=>'type_oper')),'class'=>'btn btn-info'),

			),
			'lists'=>array(
					array('name' => 'id','title' => '主键', 'format' => 'hidden' ),
	                array('name' => 'type_name','title' => '分类名', 'format' => 'text' ), 
	                array(
	                    'name' => 'create_time',
	                    'title' => '发布时间',
	                    'format' => 'function',
	                    'extra' => array(
	                        'function_name' => 'date',
	                        'params' => 'm-d H:i,###'
	                    )
	            	),
	                array(
	                	'name' => 'id',
	                	'title' => '操作', 
	                	'format' => 'custom' ,
	                	'extra'=>array(
	                		'options'=>array(
	                			'edit'=>array('title' => '编辑','url'=>web_urls('edit',array('id'=>'{id}','model'=>'type_oper')),'class'=>'btn btn-success btn-sm icon-edit'),
	                			'del'=>array('title' => '删除','url'=>web_urls('true_delete',array('id'=>'{id}','model'=>'type_oper','db'=>'ic_goods_types')),'class'=>'btn btn-success btn-sm icon-delete'),
	                		),
	                ),
	            ),   
	        ),          
			'list_map'=>array('mpid'=>get_mpid(),'status'=>array('neq',0),'pid'=>I('pid')),
			'list_order'=>array('id DESC'),
		),	
		'good_lists'=>array(
			'name'=>'ic_goods',
			'meta_title'=>'信息分类列表',
			'btn'=>array(			
			),
			'lists'=>array(
					array('name' => 'id','title' => '主键', 'format' => 'hidden' ),
	                array('name' => 'shop_name','title' => '商家名称', 'format' => 'text' ), 
	                array('name' => 'mobile','title' => '手机号码', 'format' => 'text' ),
                    array('name' => 'info_type',
                        'title' => '信息类型',
                        'format' => 'enum',
                        'extra' => array(
                            'options' => $config['info_type'],
                        )
                    ),
//                array('name' => 'good_type','title' => '信息分类', 'format' => 'text' ),
//	                array('name' => 'good_type','title' => '信息分类', 'format' => 'text' ),
	                array(
	                    'name' => 'create_time',
	                    'title' => '发布时间',
	                    'format' => 'function',
	                    'extra' => array(
	                        'function_name' => 'date',
	                        'params' => 'm-d H:i,###'
	                    )
	            	),
	        ),          
			'list_map'=>array('mpid'=>get_mpid(),'status'=>array('neq',0)),
			'list_order'=>array('id DESC'),
		),
        'pin_lists'=>array(
            'name'=>'ic_message',
            'meta_title'=>'评论列表',
            'btn'=>array(
            ),
            'lists'=>array(
                array('name' => 'id','title' => '主键', 'format' => 'hidden' ),
                array(
                    'name' => 'reply_openid',
                    'title' => '用户',
                    'format' => 'function',
                    'extra' => array(
                        'function_name' => 'get_fans_nickname',
                        'params' => '###'
                    )
                ),
                array(
                    'name' => 'content',
                    'title' => '内容',
                    'format' => 'text',
                ),
                array(
                    'name' => 'pid',
                    'title' => '回复',
                    'format' => 'function',
                    'extra' => array(
                        'function_name' => 'huifu',
                        'params' => '###'
                    )
                ),
                array(
                    'name' => 'id',
                    'title' => '操作',
                    'format' => 'custom' ,
                    'extra'=>array(
                        'options'=>array(
                            'del'=>array('title' => '删除','url'=>web_urls('true_delete',array('id'=>'{id}','model'=>'pin_oper','db'=>'ic_message','pid'=>I('pid'))),'class'=>'btn btn-success btn-sm icon-delete'),
                        ),
                    ),
                ),
            ),
            'list_map'=>array('mpid'=>get_mpid(),'status'=>array('neq',0),'gid'=>I('pid')),
            'list_order'=>array('create_time ASC'),
        ),
        'usertype_lists'=>array(
            'name'=>'ic_follow',
            'meta_title'=>'权限列表',
            'btn'=>array(
            ),
            'lists'=>array(
                array('name' => 'id','title' => '主键', 'format' => 'hidden' ),
                array(
                    'name' => 'openid',
                    'title' => '用户',
                    'format' => 'function',
                    'extra' => array(
                        'function_name' => 'get_fans_nickname',
                        'params' => '###'
                    )
                ),

            ),
            'list_map'=>array('mpid'=>get_mpid()),
            'list_order'=>array('id ASC'),
        ),
        'usertype_oper'=>array(
            'name'=>'ic_follow',
            'title'=>'设置权限',
            'fields'=>array(

            ),
            'auto'=>array(
//                array('mpid',get_mpid()),
//                array('create_time',time()),
//                array('pid',I('get.pid',0,'intval'))
            ),
            'validate'=>array(
//                array('type_name', 'require', '分类名不能为空!', 1, 'regex', 3),
            ),
        ),
        'types_oper'=>array(
			'name'=>'ic_goods_types',
			'title'=>'添加分类',
			'fields'=>array(
				array('name' => 'type_name','title' => '分类名', 'type' => 'text','placeholder'=>'输入分类名字'),
			),
			'auto'=>array(
				array('mpid',get_mpid()),
				array('create_time',time()),
				array('pid',I('get.pid',0,'intval'))
			),
			'validate'=>array(
				array('type_name', 'require', '分类名不能为空!', 1, 'regex', 3),
			),
		),
		'type_oper'=>array(
			'name'=>'ic_goods_types',
			'title'=>'添加分类',
			'fields'=>array(
				array('name' => 'type_name','title' => '分类名', 'type' => 'text','placeholder'=>'输入分类名字'),
			),
			'auto'=>array(
				array('mpid',get_mpid()),
				array('create_time',time()),
				array('pid',I('get.pid',0,'intval'))
			),
			'validate'=>array(
				array('type_name', 'require', '分类名不能为空!', 1, 'regex', 3),
			),
		),
        'good_oper'=>array(
            'name'=>'ic_goods',
            'title'=>'查看详情',
            'fields'=>array(
                array('name' => 'info_type','title' => '信息分类', 'type' => 'radio','options'=>$config['info_type']),
            ),
            'auto'=>array(
                array('mpid',get_mpid()),
                array('create_time',time()),
                array('pid',I('get.pid',0,'intval'))
            ),
            'validate'=>array(
                array('type_name', 'require', '分类名不能为空!', 1, 'regex', 3),
            ),
        ),
	)
);

?>